﻿using Q42.WinRT.Data;
using Q42.WinRT.Portable.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpaceNeedle.x6473.WindowsPhone.Common
{
    public class Cache
    {
        private DataLoader manager = new DataLoader();

        public async Task<T> Get<T>(string key, Func<Task<T>> action)
        {
            return await manager.LoadAsync(() => DataCache.GetAsync(key, action));
        }

        public async Task Delete(string key)
        {
            await DataCache.Delete(key);
        }
    }

    public class CacheKeys
    {
        public const string AppContent = "AppContent";
        public const string Requests = "Requests";
        public const string AllRequests = "AllRequests";
        public const string UserRequests = "UserRequests";
        public const string Phones = "Phones";
        public const string Alerts = "Alerts";
    }
}
